﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Avatar.Model;
using AvatarHelper;
using Avatar.Common;

public partial class Management_Company_NotCertified : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
        }
    }
    protected void btn_Monthly_Click(object sender, EventArgs e)
    {
        Button _btn = sender as Button;
        var _company = _btn.CommandArgument;
        using (var _adc = DBHelper.GetDataContext())
        {
            var _companyService = _adc.CompanyService.FirstOrDefault(s => s.Company == _company);
            if (_companyService != null)
            {
                _companyService.ServiceTypeID = 3;
            }
            else
            {
                _companyService = new CompanyService();
                _companyService.ServiceTypeID = 3;
                _companyService.Company = _company;

                _adc.CompanyService.InsertOnSubmit(_companyService);
            }
            _adc.SubmitChanges();
        }
        GridView1.DataBind();
        Helper.ShowMassage("设定包月用户成功，请转到 包月用户 管理界面为该用户设定到期日期。");
    }
    protected void btn_Vip_Click(object sender, EventArgs e)
    {
        Button _btn = sender as Button;
        var _company = _btn.CommandArgument;
        using (var _adc = DBHelper.GetDataContext())
        {
            var _companyService = _adc.CompanyService.FirstOrDefault(s => s.Company == _company);
            if (_companyService != null)
            {
                _companyService.ServiceTypeID = 2;
            }
            else
            {
                _companyService = new CompanyService();
                _companyService.ServiceTypeID = 2;
                _companyService.Company = _company;

                _adc.CompanyService.InsertOnSubmit(_companyService);
            }
                _adc.SubmitChanges();
        }
        GridView1.DataBind();
    }
}
